package com.demos.diveinspring.bootstrap;

import com.demos.diveinspring.repository.MyFirstLevelRepository;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

/**
 * 测试模式注解
 *
 * @Component -》 @Repository -》 @FirstLevelRepository ----》 类 MyFirstLevelRepository
 *
 */
@ComponentScan(basePackages = "com.demos.diveinspring.repository")
public class RepositoryBootstrap {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = new SpringApplicationBuilder(RepositoryBootstrap.class)
                .web(WebApplicationType.NONE)
                .run(args);
        MyFirstLevelRepository myFirstLevelRepository = context.getBean("myFirstLevelRepository", MyFirstLevelRepository.class);
        System.out.println("**** myFirstLevelRepository: " + myFirstLevelRepository);
        context.close();
    }
}
